package com.cykj.pos.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cykj.pos.domain.BizMerchantEpspBinding;
import com.cykj.pos.mapper.BizMerchantEpspBindingMapper;
import com.cykj.pos.service.IBizMerchantEpspBindingService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 快捷支付广发卡绑定Service业务层处理
 *
 * @author weijianbo
 * @date 2023-03-23
 */
@Service
public class BizMerchantEpspBindingServiceImpl extends ServiceImpl<BizMerchantEpspBindingMapper, BizMerchantEpspBinding> implements IBizMerchantEpspBindingService {

    @Resource
    private BizMerchantEpspBindingMapper bizMerchantEpspBindingMapper;

    @Override
    public List<BizMerchantEpspBinding> queryList(BizMerchantEpspBinding bizMerchantEpspBinding) {
        LambdaQueryWrapper<BizMerchantEpspBinding> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(bizMerchantEpspBinding.getMerchantCode())){
            lqw.eq(BizMerchantEpspBinding::getMerchantCode ,bizMerchantEpspBinding.getMerchantCode());
        }
        if (StringUtils.isNotBlank(bizMerchantEpspBinding.getCustomerCode())){
            lqw.eq(BizMerchantEpspBinding::getCustomerCode ,bizMerchantEpspBinding.getCustomerCode());
        }
        if (StringUtils.isNotBlank(bizMerchantEpspBinding.getUserName())){
            lqw.like(BizMerchantEpspBinding::getUserName ,bizMerchantEpspBinding.getUserName());
        }
        if (StringUtils.isNotBlank(bizMerchantEpspBinding.getPhoneNum())){
            lqw.eq(BizMerchantEpspBinding::getPhoneNum ,bizMerchantEpspBinding.getPhoneNum());
        }
        return this.list(lqw);
    }

    @Override
    public List<BizMerchantEpspBinding> backAccountList(BizMerchantEpspBinding bizMerchantEpspBinding) {
        return bizMerchantEpspBindingMapper.backAccountList(bizMerchantEpspBinding);
    }
}
